package com.shunli.cterminal;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;

import java.net.InetAddress;

/**
 * @author: DAI YALU
 * @ClassName: ShunliCterminalApplication
 * @description: C端服务
 * @date: 2024/4/1
 * @version: 1.0
 */
@Slf4j
@SpringBootApplication(scanBasePackages = {"com.shunli"})
@EnableFeignClients
@EnableDiscoveryClient
@MapperScan("com.shunli.cterminal.mapper")
@EnableAsync
public class ShunliCterminalApplication {

    @SneakyThrows
    public static void main(String[] args) {
        SpringApplication app=new SpringApplication(ShunliCterminalApplication.class);
        ConfigurableApplicationContext application=app.run(args);
        Environment env = application.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t" +
                        "Application '{}' is running! Access URLs:\n\t" +
                        "Local: \t\thttp://localhost:{}\n\t" +
                        "External: \thttp://{}:{}\n\t"+
                        "Doc: \thttp://{}:{}/doc.html\n"+
                        "----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                env.getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));

    }

}
